<template>
  <div class="home">
    欢迎使用山东中医药大学智能与信息工程学院学生就业信息管理系统
  </div>
</template>

<script setup lang="ts">
import { defineComponent, onMounted } from "vue";
import { message } from "ant-design-vue";
import { useStore } from "vuex";
import { StudentControllerService } from "../../generated";
import AccessEnum from "@/access/accessEnum";

const store = useStore();
const loadData = async () => {
  const userRole = sessionStorage.getItem("LoginUserRole");
  if (userRole === AccessEnum.STUDENT) {
    const res = await StudentControllerService.studentByIdUsingGet(
      store.state.user.loginUser.userId
    );
    if (res.success === true) {
      sessionStorage.setItem("LoginUserName", res.data.name);
      sessionStorage.setItem("LoginUserMajorClass", res.data.majorClass);
    } else {
      message.error("加载失败");
    }
  }
};

onMounted(() => {
  loadData();
});

// export default defineComponent({
//   name: "HomeView",
// });
</script>
